package com.orchard.orchardfarmmanagementsystem.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.orchard.orchardfarmmanagementsystem.config.CustomOffsetDateTimeDeserializer;
import lombok.Data;

import javax.persistence.*;
import java.security.Timestamp;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;

@Entity
@Data
@Table(name = "maintenance_records")
public class MaintenanceRecords {

    @Id
    @TableId(type = IdType.AUTO)
    private Integer id;

    @Column(name = "material_id", nullable = false)
    private Integer materialId;

    @Column(name = "maintenance_date", nullable = false)
    @JsonDeserialize(using = CustomOffsetDateTimeDeserializer.class)
    private OffsetDateTime maintenanceDate;

    @Column(name = "performed_by", length = 255)
    private String performedBy;

    @Column(columnDefinition = "TEXT")
    private String remarks;

    @Column(name = "created_at", updatable = false)
    @JsonDeserialize(using = CustomOffsetDateTimeDeserializer.class)
    private OffsetDateTime createdAt;

    @Column(name = "quantity")
    private Integer quantity;

    @Column(name = "maintenance_type", length = 255)
    private String maintenanceType;

    @Column(name = "status", length = 255)
    private String status;

    @Column(name = "material_name")
    private String materialName;


}